using FarseerPhysics.Dynamics;
using FarseerPhysics.Samples.ScreenSystem;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Zigzag.GameWorld
{
    class CEnemyFactory
    {
        private Texture2D _HoleTexture;
        private Texture2D _MushroomTexture;
        private Texture2D _FloorTexture;

        PhysicsGameScreen _Screen;
        EnemyType _EnemyType;

        public CEnemyFactory(PhysicsGameScreen Screen)
        {
            _Screen = Screen;
            LoadContent(Screen);
        }

        public CEnemy CreateEnemy(World World, Vector2 Position, EnemyType EnemyType)
        {
            CEnemy enemy = new CEnemy(World, _Screen, ref Position, EnemyType);
            return enemy;
        }

        public void LoadContent(PhysicsGameScreen Screen)
        {
            _HoleTexture = Screen.ScreenManager.Content.Load<Texture2D>(CAssets.HOLE_TEXTURE);
            //_MushroomTexture = Screen.ScreenManager.Content.Load<Texture2D>(CAssets.MUSHROOM_TEXTURE);
            //_FloorTexture = Screen.ScreenManager.Content.Load<Texture2D>(CAssets.FLOOR_TEXTURE);
        }

        public void Draw(CEnemy enemy)
        {
            switch (_EnemyType)
            {
                case EnemyType.Floor:
                    enemy.Draw(_FloorTexture, null, new Vector2(0, 0), enemy.Body.Rotation, CAssets.DENSITY);
                    break;
                case EnemyType.Hole:
                    enemy.Draw(_HoleTexture, null, new Vector2(0, 0), enemy.Body.Rotation, CAssets.DENSITY);
                    break;
                case EnemyType.Mushroom:
                    enemy.Draw(_MushroomTexture, null, new Vector2(0, 0), enemy.Body.Rotation, CAssets.DENSITY);
                    break;
            }
        }
    }
}
